<script type="text/javascript" language="javascript">
    // <![CDATA[
      new Draggable('ajax', {revert:false});
    // ]]>
</script>

<div id="ajax-top"><a onclick="new Effect.SwitchOff('ajax')" href="#">Close</a></div>
<div id="ajax-content">	

<?php if($session->check('Message.flash'))
		{
			$session->flash();
		} 
?>
<?php if(isset($closeajax)) : ?>

	<?php echo '<a href="#" onclick="new Ajax.Updater(\'comments\', \''.$html->url('/pages/comments_list/'.$page_id).'\', {asynchronous:true, evalScripts:true});new Effect.SwitchOff(\'ajax\');">Back</a>'; ?>

<?php else : ?>
<fieldset>
	<legend>Add a comment <?php echo $html->image('system/spinner.gif', array('style' => 'display : none', 'class'=> 'spinner', 'id' => 'spinCom')); ?></span></legend>

	<?php echo $ajax->form('/pages/commentAdd/', 'post'); ?>
	
		<div class="required"> 
			<?php echo $form->input('Comment/author');?>
		</div>
		<div class="required"> 
			<?php echo $form->input('Comment/email');?>
		</div>
		<div class="optional"> 
			<?php echo $form->input('Comment/website', array('error' => 'Please enter a valid url including "http://" or leave empty.' ));?>
		</div>
		<div class="required"> 
			<?php echo $form->textarea('Comment/content', array('cols' => '45', 'rows' => '10'));?>
			<?php echo $javascript->codeBlock("tinyMCE.addMCEControl($('CommentContent'), 'CommentContent');"); ?>
			<?php echo $form->error('Comment/content');?>
		</div>
		
		<?php echo $ajax->submit('Submit', array(
												'before' => 'tinyMCE.triggerSave(); tinyMCE.execCommand(\'mceRemoveControl\', true, \'CommentContent\');',
												'loading' => 'new Effect.Appear(\'spinCom\')',
												'update' => 'ajax',
												'complete' => 'new Effect.Fade(\'spinCom\')'
												)
								); ?>				
		
	</form>
</fieldset>
<?php endif; ?>
</div>
<div id="ajax-bot">&nbsp;</div>
